#include "core.h"
#include "RoleMgr.h"
#include "AsioTcpLink.h"
#include "xGUID.h"
#include "DbExecute.h"
#include "LogMgr.h"
#include "ComputureMgr.h"

CRole::CRole(U64 role_id)
: xObjBase(CGuidMgr::ENTITY_ROLE, role_id)
{

}

//---------------------------------------------------------------------------------------------------------------------
IMP_SINGLETON_CLASS(CRoleMgr)

CRoleMgr::CRoleMgr()
{

}

CRoleMgr::~CRoleMgr()
{

}

CRole* CRoleMgr::CreateRoleByDB(const CDbExecute::DATA_ROW_MAP& rowData)
{
	return NULL;
}

void CRoleMgr::LoadFromDB()
{
	char sql[ 1024 ] = {0};
	CDbExecute db;

	strcpy( sql, "select role_id, user_account, role_data from role");

	db.execute(sql);

	const CDbExecute::DATA_VEC_MAP& vData = db.GetDataMap();
	CDbExecute::DATA_VEC_MAP_ITRC itr = vData.begin();
	CDbExecute::DATA_VEC_MAP_ITRC itrE = vData.end();

	for ( ; itr != itrE; ++itr )
	{
		const CDbExecute::DATA_ROW_MAP& rowData = *itr;
		CreateRoleByDB(rowData);
	}
}
